
import { NgxOlAction, NgxOlActionTypes } from '../actions';

export interface NgxOlState {
    graticuleVisible: boolean;
}

export const initialNgxOlState: NgxOlState = {
    graticuleVisible: false
};

export function ngxOlReducer(state: NgxOlState = initialNgxOlState, action: NgxOlAction): NgxOlState {
    switch(action.type) {
        case NgxOlActionTypes.NGX_OL_VISIBLE_GRATICULE: {
            const graticuleVisible: boolean = action.payload;
            return {
                ...state,
                graticuleVisible
            };
        }
        default: {
            return state;
        }
    }
}